package Pet.Management.repository;

import Pet.Management.domain.entity.Captcha;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

public interface CaptchaRepository extends JpaRepository<Captcha, String> {
    
    @Modifying
    @Transactional
    @Query("DELETE FROM Captcha c WHERE c.expireTime < ?1")
    void deleteExpiredCaptchas(LocalDateTime now);
} 